#ifndef _CANIMATEDOBJECT_H_
#define _CANIMATEDOBJECT_H_

#include "CAnimationProperties.h"
#include "cocos2d.h"
#include "Box2D/Box2D.h"

enum ECategoryBit{
	// The category bits are used to filter colliding objects.
	shipCategoryBit = 1,
	bulletCategoryBit ,
	enemyCategoryBit ,
	shieldCategoryBit
};
/**
 * Base class for GameCharacters, holds the sprite.
 */
class CAnimatedObject :
	public cocos2d::CCSprite
{
public:
	CAnimatedObject();
	~CAnimatedObject();
	bool init(char* frameNamePrefix, cocos2d::CCSpriteBatchNode* pSpriteSheet, b2World* pWorld = NULL);
	void addAnimation(CAnimationProperties* pAnimationProperties);
	cocos2d::CCRect getRect();
	void destroy();
	b2Body* getBody();
	virtual void collision();
	virtual void collision(float damage);
	void setDelete(bool del);
	bool getDelete();

protected:
	/**
	 * This array holds animations specified for the particular AnimatedObject.
	 */
	cocos2d::CCArray* _pAnimations;

	/**
	 * The sprite sheet is created and released by the MainLayer.
	 */
	cocos2d::CCSpriteBatchNode*					   _pSpriteSheet;

	/**
	 * Indicates if the object should be deleted on update.
	 */
	bool										   _delete;

	/**
	 * This Box2D world is set in the MainLayer and passed to the AnimatedObject through the constructor.
	 */
	b2World* 									   _pWorld;

	/**
	 * The Box2D body covering the sprite.
	 */
	b2Body*										   _pBody;
};

#endif //_CANIMATEDOBJECT_H_
